<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
	<title>登录微美风铃——美容院专属拓客利器</title>
	<meta charset="utf-8"/>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<!--[if lt IE 9]>
	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
	<link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/css/bootstrap.min.css">
	
	<style>
		body{font-family: "Microsoft YaHei";}
		.wmfl-admin-login{position:absolute; width:100%; top:150px; z-index:999;}
		.wmfl-login-wrap .input-group{margin-bottom:10px;}
		.wmfl-login-wrap h3{font-family: "Microsoft YaHei";}
		.wmfl-login-wrap form{margin:0 20px;}
		.wmfl-login-lay{overflow:hidden; position:absolute; left:0; top:0; z-index:-1;}
		#auth{width:100px;}
		#submit{margin-right:5px;}
	</style>
</head>
<body>
	<section class="wmfl-admin-login">
		<div class="container">
			<div class="col-lg-7">
				<div class="wmfl-logo"><img src="/Public/Style/Common/images/wmfl_logo.png" /></div>
				<div class="wmfl-intro"></div>
			</div>
			
			<div class="col-lg-5">
				<div class="wmfl-login-wrap panel panel-primary">
					<div class="panel-heading">
						<h3><?php echo ($moduleTitle); ?></h3>
					</div>
					<form action="" method="post" role="form" class="panel-body" id="form">
						
						<div class="input-group">
						  <span class="input-group-addon">邮　箱</span>
						  <input type="email" class="form-control" name="email" id="email" placeholder="输入登录邮箱">
						</div>
						
						<div class="input-group">
						  <span class="input-group-addon">密　码</span>
						  <input type="password" class="form-control" name="password" id="password" placeholder="输入登录密码">
						</div>
						
						<div class="input-group">
						  <span class="input-group-addon">验证码</span>
						  <input type="text" class="form-control" name="verify" id="auth" />
						  <img class="auth-img" src="/index.php/Admin/Login/verify" title="点击更换验证码" style="cursor:pointer;"/>
						</div>
						
						<div class="input-group">
						  <span class="input-group-addon invisible">密　码</span>
						  <button type="submit" class="btn btn-primary" id="submit">登录</button>
						  <span id="message"></span>
						</div>
					</form>
				</div>
			</div>
			
		</div>
	</section>
	<div id="wmfl-login-lay" class="wmfl-login-lay"></div>
	<script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
	<script src="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
	<script type="text/javascript">
	
		//防止iframe嵌套
		$(function(){
			if(window != top){top.location.href = location.href;}	
		});
	
		$(function(){
			var oLay = $("#wmfl-login-lay"),
				w = $(window).width(),
				h = $(window).height(),
				img = [
					"/Public/Style/Admin/Default/images/wmlogin_bg1.jpg",
		       	];
			oLay.css({width: w + "px", height: h + "px"});
			
			var random = Math.floor(Math.random()*img.length);
			var oImg = new Image();
			oImg.src = img[random];
			oImg.onload = function(){
				//控制宽高
				var _thisW = this.width;
				var _thisH = this.height;
				(w/h) > (_thisW/_thisH) ? (this.width = w) : (this.height = h);

				$(this).fadeIn(1000);
				$(this).appendTo(oLay);	
			};
			
			$(".auth-img").click(function(){
				this.src = "/index.php/Admin/Login/verify";
			});
		});
		
		$(window).resize(function(){
			var	oLay = $("#wmfl-login-lay"),
				w = $(window).width(),
				h = $(window).height(),
				oImg = new Image(),
				img = oLay.children("img");
			oImg.src = img.attr("src");
			var _thisW = oImg.width,
				_thisH = oImg.height,
				imgScale = _thisW/_thisH;
				documentScale = w/h;
			
			oLay.css({width: w+"px", height: h+"px"});
			if(documentScale < imgScale){
				img.css({width: h*imgScale + "px", height: h + "px"});
			}else{
				img.css({width: w + "px", height: w/imgScale + "px"});
			}
			img.css({top:(img.outerHeight() - h + "px")});
		});
		
		//表单提交
		document.onkeydown = function(ev)
		{
			var oEvent = ev || window.event;
			if(oEvent.keyCode == 13){
				return submitForm();
			};
		}
		
		$("#submit").click(function(){
			return submitForm();
		});
		
		
		function submitForm()
		{
			var msg = $("#message"),
				emailVal = $("#email").val(),
				passVal = $("#password").val(),
				authVal = $("#auth").val();
			
			if ( emailVal == "" ) {
				msg.html("登录邮箱不能为空");
				$("#email").focus();
			} else if ( passVal == "" ){
				msg.html("登录密码不能为空");
				$("#password").focus();
			} else if ( authVal == "" ) {
				msg.html("验证码不能为空");
				$("#auth").focus();
			} else {
				$("#submit").html("登录中……").attr("disabled", "true");
				msg.html("");
				
				$.post("/index.php/Admin/Login/login",$("#form").serialize(),function(data){
					if(data.error == 0)
					{
						setTimeout(function(){
							location.href = "/index.php/Admin/index";
						},1000)
					}else{
						$("#submit").html("登录").removeAttr("disabled");
						$(".auth-img").attr("src", "/index.php/Admin/Login/verify?"+new Date().getTime());
					}
					msg.html(data.message);
				},'json');
			}
			return false;
		};
		
		
		//对支持本地存储的浏览器储存填入的email，可以存储多至5M的数据。这一定可以为用户带来更好的用户体验。
		if(window.FileReader){
			var email = document.getElementById("email");
			if( localStorage.getItem("email") ){
				email.value = localStorage.getItem("email");
			}
			function storageEmail(){
				localStorage.setItem("email", this.value);
			}
			email.addEventListener("keyup", storageEmail, false);
		}
		
	</script>
  <!--<script src="/Public/Static/js/snow.js" type="text/javascript" charset="utf-8"></script>-->
</body>
</html>